home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
By Popular Request 2.0
/
By Popular Request 2.0 (Arsenal Computer).ISO
/
amiga_4
/
mm_1_0.lha
/
MM
/
Contrib
/
EMS_to_MM.lha
/
EMStoMM.ems
next >
Wrap
Text File
|
1995-02-09
|
17KB
|
682 lines
/* RH 05.02.95 */
parse arg cfg .
address command
call Include_Lib('ems_rexx')
LF = 'a'x
if cfg='' then
do
cfg='MM:config/Mailmanager.cfg'
if EMS_File_Select('MailManager config-file', 'cfg')='CANCEL' then exit
if exists(cfg) then
if EMS_Do_Request('"'cfg'"'LF'already exists!'LF || LF'Overwrite it?'LF, 'YES|NO')='NO' then exit
end
if ~open(out, cfg, w) then
do
say '*** ERROR: Unable to open' cfg'!!!'
exit 20
end
dlg. = 0
if EMS_Do_Request('Are you using DLG?', 'YES|NO')='YES' then dlg.dlg = 1
call Set_General
call Ask_Aliases
call Get_Addresses
call Get_Groups
call Get_Archivers
call Get_Nodes
call Get_Routing
call Get_Areas
call EMS_Do_Request("NOTE:"LF"Archivers, routing & custom-text's"LF"have to be configured manually!", "OK")
call EMS_Do_Request("*** ALL DONE ***", "OK")
call close(out)
userlist = Get_Userlist()
replace(editor, cfg, '%s')
replace(editor, userlist, '%s')
exit
Ask_Aliases: procedure
say 'Asking for aliases...'
call writeln(out, ';Aliases')
do until ret='CANCEL'
ret = EMS_String_Select('Please enter the alias-id', 'name')
if ret='CANCEL' then iterate
ret = EMS_String_Select('Please enter the alias-name', 'alias')
if ret='CANCEL' then iterate
call writeln(out, '#SYSOPNAME' strip(name) '"'strip(alias)'"')
name = ''
alias = ''
end
call writeln(out, '')
return
Get_Addresses: procedure Expose path. akas address.
say 'Setting addresses...'
call writeln(out, ';Addresses')
akas = ''
address. = ''
a = 0
call EMS_Domains('domain')
call EMS_Sort_Stem('domain')
do n=1 to domain.0
tmp = domain.n
tmp2 = path.general || tmp
call EMS_String_Select('Areas-path for domain "'tmp'"', 'tmp2')
path.tmp = path(tmp2)
call EMS_Akas('aka', domain.n)
call EMS_Sort_Stem('aka')
akas = akas aka.1
aka.1 = Make_5D(aka.1)
address.n = aka.1
call writeln(out, '#ADDRESS' left(aka.1, max(length(aka.1), 25)) '0')
do m=2 to aka.0
akas = akas aka.m
aka.m = Make_5D(aka.m)
call writeln(out, left('#AKA', 8) left(aka.m, max(length(aka.m), 25)) '0')
end
end
address.0 = domain.0
call writeln(out, '')
return
Get_Areas: procedure Expose path. akas cmd. dlg.
say 'Setting areas...'
call writeln(out, ';Areas')
call EMS_Areas('area', , 'MAIL')
do n=1 to area.0
call Set_Area(area.n, 'MAIL')
end
call Set_Area('BAD_MSGS', 'BAD')
call EMS_Areas('area', , 'ECHO')
do n=1 to area.0
if area.n='BAD_MSGS' then iterate
call Set_Area(area.n, 'ECHO')
end
call EMS_Areas('area', , 'FILE')
do n=1 to area.0
call Set_Area(area.n, 'FECHO')
end
call EMS_Areas('area', , 'TICK')
do n=1 to area.0
call Set_Area(area.n, 'TICK')
end
say
return
Get_Archivers: procedure Expose arc_cfg
call writeln(out, ';Archivers')
call writeln(out, ';*** Sorry, this has to be done manually! ***')
call writeln(out, '')
return
Get_Domain_Addr: procedure Expose address.
arg . '@' domain .
do n=1 to address.0
parse value upper(address.n) with . '@' check .
if check=domain then return address.n
end
return '9999:9999/9999@wrongnet'
Get_Groups: procedure Expose cmd. def_cmd dlg.
say 'Setting groups...'
call writeln(out, ';Groups')
call EMS_Areas('area')
do n=1 to area.0
'echo "." noline'
group = strip(EMS_Area_Group_Name(area.n))
if group='' then iterate
call EMS_Add_To_Stem('groups', upper(group), 'UNIQUE')
end
call EMS_Nodes('node')
do n=1 to node.0
'echo "." noline'
call EMS_Node_Groups_Get(node.n, 'group')
do m=1 to group.0
call EMS_Add_To_Stem('groups', upper(group.m.0), 'UNIQUE')
end
end
call EMS_Sort_Stem('groups')
call writeln(out, '#GROUP DUMMY ; *** THIS GROUP WAS SET TO AREAS BELONGING TO NO GROUP!!!! ***' )
cmd. = ''
do n=1 to groups.0
call writeln(out, '#GROUP' groups.n)
end
call writeln(out, '')
call writeln(out, ';Tickcommands')
say
do n=1 to groups.0
group = upper(groups.n)
tmp = group
if EMS_String_Select('TickCommand-Name for "'group'"', 'tmp')='CANCEL' then iterate
cmd.group = upper(strip(tmp))
tmp = replace(def_cmd, group, '%g%')
if EMS_String_Select('TickCommand for "'cmd.group'"', 'tmp')='CANCEL' then iterate
call writeln(out, '#TICKCOMMAND' left(cmd.group, max(length(cmd.group), 15)) '"'tmp'"')
tmp=''
if dlg.dlg then
if EMS_String_Select('Announcement-areas for "'cmd.group'"', 'tmp')~='CANCEL' then
do
do while tmp~=''
parse var tmp area tmp
area = strip(area)
if area='' then iterate
dlg.group = dlg.group || area'+'
end
dlg.group = '#AREAS=('upper(strip(dlg.group, 'b', '+'))')'
end
say left(group, 20) left(cmd.group, 10) tmp
end
call writeln(out, '')
say
return
Get_Links: procedure Expose akas
arg area
call EMS_Areafix_Area_Links_Get(area, 'link')
call EMS_Sort_Stem('link')
str = ''
do n=1 to link.0
if find(akas, link.n)>0 then iterate
parse var link.n zone ':' net '/' node '@' .
parse var node node '.' point .
if point~='' then
if point=0 then point = ''
else point = '.'point
select
when last_zone~=zone then str = strip(str zone':'net'/'node || point)
when last_net~=net then str = strip(str net'/'node || point)
when last_node~=node then str = strip(str node || point)
when last_point~=point then str = strip(str point)
otherwise nop
end
last_zone = zone
last_net = net
last_node = node
last_point = point
end
return strip(str)
Get_Nodes: procedure Expose newareas address.
say 'Setting nodes...'
call writeln(out, ';Nodes')
call EMS_Nodes('node')
call EMS_Sort_Stem('node')
do n=1 to node.0
'echo "." noline'
parse value upper(EMS_Node_Addressing(node.n)) with . '_' tmp .
if tmp='' then iterate
if tmp='3D' then tmp='4D'
addr_type = 'ADDR'tmp
parse value upper(EMS_Node_Packet_Type(node.n)) with . '_' tmp .
select
when tmp='2' then pkt_type = 'PACK3D'
when tmp='2+' then pkt_type = 'PACK4D'
when tmp='2.2' then pkt_type = 'PACK5D'
otherwise iterate
end
node = Make_5D(node.n)
flavor = upper(EMS_Node_Flavor(node.n))
arcer = upper(EMS_Node_Archiver(node.n))
Pkt_PW = upper(strip(EMS_Node_Packet_Pwd_In(node.n)))
Areafix_PW = upper(strip(EMS_Node_Areafix_Pwd_In(node.n)))
if Areafix_PW='' then Areafix_PW = upper(strip(EMS_Node_Areafix_Pwd_Out(node.n)))
if arcer='' then arcer = 'LHA'
if Pkt_PW~='' then Tick_PW = Pkt_PW
else Tick_PW = Areafix_PW
call writeln(out, '#NODE' left(node, max(length(node.n), 25)) addr_type pkt_type flavor flavor arcer)
call EMS_Node_Groups_Get(node.n, 'group')
do m=1 to group.0
call writeln(out, 'Group' left(upper(group.m.0), max(length(group.m.0), 15)) group.m.1)
end
if Pkt_PW~='' then call writeln(out, 'PacketPW "'Pkt_PW'"')
if Areafix_PW~='' then call writeln(out, 'AreaFixPW "'Areafix_PW'"')
if Tick_PW~='' then call writeln(out, 'TickPW "'Tick_PW'"')
if EMS_Node_CanCreateAreas(node.n)='TRUE' then call writeln(out, 'CanCreateAreas' newareas Get_Domain_Addr(node) 'PassThrough DUMMY 100')
call writeln(out, '')
end
call writeln(out, '')
say
return
Get_Routing: procedure
call writeln(out, ';Routing')
call writeln(out, ';*** Sorry, this has to be done manually! ***')
call writeln(out, '')
return
Get_Userlist: procedure Expose LF
say 'Converting userlist...'
cfg='MM:config/MailManager.UserList'
if EMS_File_Select('MailManager-Userlist', 'cfg')='CANCEL' then return
if exists(cfg) then
if EMS_Do_Request('"'cfg'"'LF'already exists!'LF || LF'Overwrite it?'LF, 'YES|NO')='NO' then return
if ~open(out, cfg, w) then
do
say '*** ERROR: Unable to open' cfg'!!!'
return
end
emscfg = 'ems:config/userlist'
if ~open(in, emscfg, 'r') then
do
say '*** ERROR: Unable to open' emscfg'!!!'
return
end
do while ~eof(in)
parse value readln(in) with first '=' rest
if first='' then iterate
key = upper(first)
select
when key='NAME' then
do
name = '"'strip(rest, 'b', '" ')'"'
nick = ''
end
when key='NICK' then nick = strip(word(rest, 1), 'b', '" ')
when key='NOTE' then nop
otherwise
do
parse var first first second .
'echo . NOLINE'
call writeln(out, left(name, max(length(name), 30)) left(first, max(length(first), 30)) nick)
if second~='' then
do
'echo . NOLINE'
call writeln(out, left(name, max(length(name), 30)) left(second, max(length(second), 30)) nick)
end
end
end
end
say
call close(in)
call close(out)
'c:sort' cfg cfg
return cfg
Include_Lib: procedure
parse arg lib, prio
if right(upper(lib), 8)~='.LIBRARY' then lib=lib'.library'
if prio='' then prio=0
if ~show('l', lib) then
if ~addlib(lib, prio, -30, 0) then
do
say '*** ERROR: Could not open' lib'!!! ***'
exit 10
end
return
Make_5D: procedure
parse arg zone ':' net '/' node '@' domain .
parse var node node '.' point
if point='' then point=0
return zone':'net'/'node'.'point'@'domain
Path: procedure
parse arg path
if right(path,1) ~= '/' & right(path,1) ~= ':' then path = path'/'
return path
Replace: procedure
parse arg string,new,old
do while index(string, old) ~= 0
interpret "parse var string l '"old"' r"
string = l || new || r
end
return string
Set_Area: procedure Expose path. akas cmd. dlg.
parse arg area, type
'echo "." NOLINE'
name = '"'area'"'
addr = Make_5D(EMS_Area_Address(area))
domain = EMS_Address_GetDomain(addr)
path = path(strip(EMS_Area_Msg_Path(area)))
altpath = path(strip(EMS_Area_Msg_AltPath(area)))
access = 'W'
show = 'All'
sortby = 'Number'
mlimit = min(left(EMS_Area_Maint_Limit(area),3), 10)
group = upper(strip(EMS_Area_Group_Name(area)))
if group='' then group = 'DUMMY'
level = EMS_Area_Group_Level(area)
if level='' | level=0 then level = 100
mmode = upper(EMS_Area_Maint_Mode(area))
if index(mmode, 'BYNUM')>0 then mmode = 'Number'
else mmode = 'Date'
if EMS_Area_TwoPassImport(area)~='FALSE' then import = 'TwoPassImport'
else import = ''
if EMS_Area_PassThrough(area)='TRUE' then msgbase='PassThrough'
else
do
parse value upper(EMS_Area_Msg_DBname(area)) with tmp '_' .
select
when tmp='IFIDO' then msgbase = 'Indexed'
when tmp='QUICK' then msgbase = 'Quick'
when tmp='QPACK' then msgbase = 'Compressed'
otherwise msgbase = 'Plain'
end
end
desc = strip(EMS_Area_Msg_Description(area))
if desc='' then desc='(no description available)'
desc = '"'desc'"'
if altpath~='' then altpath = path(altpath)
links = Get_Links(area)
if type~='TICK' then
do
call writeln(out, left('#'type'AREA', 10) left(name, max(length(name), 27)) left(area, max(length(area), 24)) left(path, max(length(path), 40)) left(addr, max(length(addr), 25)) left(group, max(length(group), 14)) level)
call writeln(out, 'MsgBase ' msgbase)
call writeln(out, 'Show ' show)
call writeln(out, 'SortBy ' sortby)
call writeln(out, 'DeleteBy ' mmode mlimit)
if import~='' then call writeln(out, import)
end
else
do
if dlg.dlg then
do
path = path(strip(EMS_Area_File_Path(area)))
altpath = path(strip(EMS_Area_File_AltPath(area)))
usrflags = dlg.group
if altpath='/' then altpath = path
end
else
do
if altpath='' then altpath = path
else path = altpath
usrflags = ''
end
call writeln(out, '#'type'AREA' left(area, max(length(area), 24)) left(altpath, max(length(altpath), 40)) left(addr, max(length(addr), 25)) left(group, max(length(group), 14)) level)
if cmd.group~='' then call writeln(out, 'TickCommand' cmd.group)
end
if links~='' then call writeln(out, 'Nodes ' links)
if desc~='' then call writeln(out, 'Desc ' desc)
if altpath~='' then call writeln(out, 'AltPath ' altpath)
if usrflags~='' then call writeln(out, 'UserFlags ' '"'usrflags'"')
call writeln(out, '')
return
Set_General: procedure Expose path. editor newareas def_cmd
say 'General configs...'
tab = 17
call writeln(out, '#DEFSYSOPNAME' ' "'strip(EMS_Var_Local('SYSOP_NAME'))'"')
call writeln(out, '')
call writeln(out, ';General config part')
tmp = 'In:'
if EMS_String_Select('Please enter your INBOUND-dir', 'tmp')~='CANCEL' then
call writeln(out, left('#INBOUND', tab) path(strip(tmp)))
tmp='Out:'
if EMS_String_Select('Please enter your OUTBOUND-dir', 'tmp')~='CANCEL' then
do
outbound = path(strip(tmp))
call writeln(out, left('#OUTBOUND', tab) outbound)
end
else outbound = ''
tmp=outbound'Bundles'
if EMS_String_Select('Please enter your BUNDLE-dir', 'tmp')~='CANCEL' then
call writeln(out, left('#BUNDLEDIR', tab) path(strip(tmp)))
tmp=outbound'Ticks'
if EMS_String_Select('Please enter your TIC-dir', 'tmp')~='CANCEL' then
call writeln(out, left('#TICDIR', tab) path(strip(tmp)))
tmp_dir = path(EMS_Var_Local('TEMP_DIR'))
tmp=tmp_dir'Pkts'
if EMS_String_Select('Please enter your TEMPPKTDIR-dir', 'tmp')~='CANCEL' then
call writeln(out, left('#TEMPPKTDIR', tab) path(strip(tmp)))
tmp='Bad:'
if EMS_String_Select('Please enter your BADDIR-dir', 'tmp')~='CANCEL' then
call writeln(out, left('#BADDIR', tab) path(strip(tmp)))
call writeln(out, left('#BACKUPDIR', tab) path(EMS_Var_Local('BACKUP_DIR')))
call writeln(out, left('#WORKDIR', tab) tmp_dir)
newareas = strip(EMS_Var_Local('NEWAREAS_MSG_PATH'))
newareas = left(newareas, pos('%', newareas)-1)
if EMS_String_Select('Please enter your MSGBASEDEVice', 'newareas')~='CANCEL' then
do
path.general = path(strip(newareas))
call writeln(out, left('#MSGBASEDEV', tab) path.general)
end
else path.general = ''
call writeln(out, left('#STATS', tab) '"MM:Config/MailManager.Stats"')
call writeln(out, left('#USERLIST', tab) '"MM:Config/MailManager.Userlist"')
call writeln(out, left('#NODELISTDIR', tab) path(EMS_Var_Local('NODELIST_PATH')))
editor=strip(EMS_Var_Local('SCRIPT_EDITOR_NAME')) '%s' strip(EMS_Var_Local('SCRIPT_EDITOR_ARGS'))
call writeln(out, left('#EDITOR', tab) '"'editor'"')
call writeln(out, left('#DEFORIGIN', tab) '"'strip(EMS_Var_Local('ORIGIN_NAME'))'"')
call writeln(out, left('#DELETECHAR', tab) '#')
call writeln(out, left('#PREPARSEKLUDGE', tab) '"\8"')
call writeln(out, left('#PREPARSEQUOTED', tab) '"\3"')
tmp = EMS_Var_Local('LOG_LEVEL')
call writeln(out, left('#ECHOLEVEL', tab) tmp)
call writeln(out, left('#LOGLEVEL', tab) tmp)
tmp='CON:0/433/720/107/Mail Manager Log Window/AUTO/INACTIVE/SCREEN MMScreen'
if EMS_String_Select('Please enter your LOGWINDOW', 'tmp')~='CANCEL' then
call writeln(out, left('#LOGWINDOW', tab) '"'strip(tmp)'"')
tmp='Logs:MM.log'
if EMS_String_Select('Please enter your LOGFILE', 'tmp')~='CANCEL' then
call writeln(out, left('#LOGFILE', tab) '"'strip(tmp)'"')
call writeln(out, left('#ARCHIVEFILE', tab) '"'path(EMS_Var_Local('SCRIPT_TEXT_DIR'))'MM_Mail.txt"')
call writeln(out, left('#MINFREEMEM', tab) EMS_Var_Local('MIN_FREEMEM_SIZE')%1024)
call writeln(out, left('#MAXPKTSIZE', tab) EMS_Var_Local('MAX_PACKET_SIZE')%1024 )
call writeln(out, left('#MAXBUNDLESIZE', tab) EMS_Var_Local('MAX_ARCHIVE_SIZE')%1024)
call writeln(out, left('#AREAORDER', tab) 'CONFIG')
if EMS_Switch_Local('KEEP_MATRIX')='ON' then tmp=''
else tmp='NO'
call writeln(out, '#'tmp'KEEPMATRIX')
if EMS_Do_Request('Keep Sysop-mail?', 'YES|NO')='YES' then tmp=''
else tmp='NO'
call writeln(out, '#'tmp'KEEPSYSOP')
if EMS_Do_Request('Check domains (real 5D)?', 'YES|NO')='YES' then tmp=''
else tmp='NO'
call writeln(out, '#'tmp'CHECKDOMAIN')
if EMS_Do_Request('Use domains in origins?', 'YES|NO')='YES' then tmp=''
else tmp='NO'
call writeln(out, '#'tmp'ORIGIN5D')
if EMS_Switch_Local('DO_BACKUP')='ON' then tmp=''
else tmp='NO'
call writeln(out, '#'tmp'DOBACKUP')
if EMS_Do_Request('Show PASSTHROUGH-areas?', 'YES|NO')='YES' then tmp=''
else tmp='NO'
call writeln(out, '#'tmp'SHOWPASSTHRO')
call writeln(out, '#CRUNCHMAIL')
call writeln(out, '#TEXTSTYLES')
call writeln(out, '#SHOWKLUDGES')
call writeln(out, '#QUOTEKLUDGES')
call writeln(out, '#REFLOW')
if EMS_Switch_Local('KILL_DUPES')='ON' then tmp='KILL'
else tmp='BAD'
call writeln(out, left('#CHECKDUPE', tab) tmp)
tmp='%s %a %p %P %u %d %n %N %m %M %r %R %o %f'
if EMS_String_Select('Please enter a default Tick-COMMAND', 'tmp')='CANCEL' then def_cmd = ''
else def_cmd = strip(tmp)
call writeln(out, '#SMARTEXPORT')
call writeln(out, '')
return